package Model;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by FreyrWings on 2017/5/24.
 * The post object
 */
public class Post {
    private int id;
    private String title;
    private String image;
    private String description;
    private Date date;
    private int accountid;

    public int getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }

    public String getImage() {
        return image;
    }

    public String getDate(){
        return (new SimpleDateFormat("MMM,dd,yyyy", Locale.ENGLISH)).format(date);
    }

    public int getAccountid() {
        return accountid;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setDate(String date){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date d = sdf.parse(date);
            this.date = d;
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }

    public void setAccountid(int accountid) {
        this.accountid = accountid;
    }
}
